Azure API Management policy reference

您所在的位置:网站首页 cache lookup failed for type 1 Azure API Management policy reference

Azure API Management policy reference

2023-11-28 10:30| 来源: 网络整理| 查看: 265

Get from cache Article 08/15/2023

Use the cache-lookup policy to perform cache lookup and return a valid cached response when available. This policy can be applied in cases where response content remains static over a period of time. Response caching reduces bandwidth and processing requirements imposed on the backend web server and lowers latency perceived by API consumers.

Note

This policy must have a corresponding Store to cache policy.

Important

Built-in cache is volatile and is shared by all units in the same region in the same API Management service.

Note

Set the policy's elements and child elements in the order provided in the policy statement. To help you configure this policy, the portal provides a guided, form-based editor. Learn more about how to set or edit API Management policies.

Policy statement Accept Accept-Charset Authorization header name parameter name Attributes Attribute Description Required Default allow-private-response-caching When set to true, allows caching of requests that contain an Authorization header. Policy expressions are allowed. No false caching-type Choose between the following values of the attribute:- internal to use the built-in API Management cache,- external to use the external cache as described in Use an external Azure Cache for Redis in Azure API Management,- prefer-external to use external cache if configured or internal cache otherwise.

Policy expressions aren't allowed.

No prefer-external downstream-caching-type This attribute must be set to one of the following values.

- none - downstream caching is not allowed.- private - downstream private caching is allowed.- public - private and shared downstream caching is allowed.

Policy expressions are allowed.

No none must-revalidate When downstream caching is enabled this attribute turns on or off the must-revalidate cache control directive in gateway responses. Policy expressions are allowed. No true vary-by-developer Set to true to cache responses per developer account that owns subscription key included in the request. Policy expressions are allowed. Yes false vary-by-developer-groups Set to true to cache responses per user group. Policy expressions are allowed. Yes false Elements Name Description Required vary-by-header Add one or more of these elements to start caching responses per value of specified header, such as Accept, Accept-Charset, Accept-Encoding, Accept-Language, Authorization, Expect, From, Host, If-Match. No vary-by-query-parameter Add one or more of these elements to start caching responses per value of specified query parameters. Enter a single or multiple parameters. Use semicolon as a separator. No Usage Policy sections: inbound Policy scopes: global, workspace, product, API, operation Gateways: dedicated, consumption, self-hosted Usage notes API Management only performs cache lookup for HTTP GET requests. When using vary-by-query-parameter, you might want to declare the parameters in the rewrite-uri template or set the attribute copy-unmatched-params to false. By deactivating this flag, parameters that aren't declared are sent to the backend. This policy can only be used once in a policy section. Examples Example with corresponding cache-store policy version Example using policy expressions

This example shows how to configure API Management response caching duration that matches the response caching of the backend service as specified by the backend service's Cache-Control directive.

Accept Accept-Charset

For more information, see Policy expressions and Context variable.

Related policies API Management caching policies Related content

For more information about working with policies, see:

Tutorial: Transform and protect your API Policy reference for a full list of policy statements and their settings Policy expressions Set or edit policies Reuse policy configurations Policy snippets repo


【本文地址】


今日新闻


推荐新闻


CopyRight 2018-2019 办公设备维修网 版权所有 豫ICP备15022753号-3